/**
 * Copyright 2011, Under-Ground Studio.
 *  
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *  
 *      http://www.apache.org/licenses/LICENSE-2.0
 *  
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package cn.edu.zju.vlis.aus.chart;

/**
 * Instance of this class represents a piece of data that can be drawn in
 * charts.
 * 
 * @author ymsong (songyuming1985@gmail.com) 2011-8-4
 */
public class ChartDataItem {
	// id of this data.
	private String id;
	// the label.
	private String label;
	// the number.
	private float number;
	// the color of this data.
	private int color;
	// the space for storing data.
	private Object metaData;

	public ChartDataItem() {
	}
	
	public ChartDataItem(String id, String label, float number, int color) {
		this.id = id;
		this.label = label;
		this.number = number;
		this.color = color;
	}
	
	/**
	 * @return the id
	 */
	public String getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(String id) {
		this.id = id;
	}

	/**
	 * @return the label
	 */
	public String getLabel() {
		return label;
	}

	/**
	 * @param label
	 *            the label to set
	 */
	public void setLabel(String label) {
		this.label = label;
	}

	/**
	 * @return the number
	 */
	public float getNumber() {
		return number;
	}

	/**
	 * @param number
	 *            the number to set
	 */
	public void setNumber(float number) {
		this.number = number;
	}

	/**
	 * @return the color
	 */
	public int getColor() {
		return color;
	}

	/**
	 * @param color
	 *            the color to set
	 */
	public void setColor(int color) {
		this.color = color;
	}
	
	/**
	 * @return the metaData
	 */
	public Object getMetaData() {
		return metaData;
	}

	/**
	 * @param metaData the metaData to set
	 */
	public void setMetaData(Object metaData) {
		this.metaData = metaData;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o)
			return true;
		else if (o instanceof ChartDataItem) {
			ChartDataItem item = (ChartDataItem) o;
			return id == null ? item.id == null : id.equals(item.id);
		} else {
			return false;
		}
	}
}
